home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld: Complete Mac Interactive
/
Macworld Complete Mac Interactive CD)(1994).iso
/
The Best of BMUG
/
Utilities
/
Control Panels and Extensions
/
ClipboardMagician.76
/
iconpict.p
< prev
next >
Wrap
Text File
|
1990-12-11
|
2KB
|
64 lines
unit UConvertor;
interface
const
{the constants are for use of the simulator only }
testID = 128; { change to reflect code resource ID }
testType = 'ICON'; { change to reflect the data type you are testing }
type
routineInfo = record
entryPoint: ProcPtr;
resID: Integer;
parmCount: Integer;
useDefault: boolean;
end;
routineInfoPtr = ^routineInfo;
parmInfo = record
srcType: ResType;
srcHandle: Handle;
dstType: ResType;
dstHandle: Handle;
end;
parmInfoPtr = ^parmInfo;
{ the name xMain is for debugging use only, change to Main before making the code resource }
function xMain (myInfoPtr: routineInfoPtr; parmPtr: parmInfoPtr): OSErr;
implementation
function CallExt (rtnRsrc: ResType; NamePtr: Str255; parmCount: integer; useDefault: Boolean; parmPtr: Ptr; theAddr: Ptr): OSErr;
inline
$205F, $4e90; { move.l (A7)+, A0; jsr (A0)}
function xMain (myInfoPtr: routineInfoPtr; parmPtr: parmInfoPtr): OSErr;
var
r: rect;
aBitMap: BitMap;
orgPort: GrafPtr;
tempPort: GrafPort;
err: OSErr;
begin
HLock(parmPtr^.srcHandle);
GetPort(orgPort);
OpenPort(@tempPort);
SetRect(r, 0, 0, 32, 32);
ClipRect(r);
with aBitMap do
begin
baseAddr := parmPtr^.srcHandle^;
rowBytes := 4;
bounds := r;
end;
parmPtr^.dstHandle := Handle(OpenPicture(r));
if parmPtr^.dstHandle <> nil then
begin
parmPtr^.dstType := 'PICT';
CopyBits(aBitMap, tempPort.portBits, aBitMap.bounds, r, srcCopy, nil);
ClosePicture;
end;
ClosePort(@tempPort);
SetPort(orgPort);
HUnLock(parmPtr^.srcHandle);
xMain := NoErr;
end;
end.